/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fri.entiry;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author NguyenDongUIT
 */
@Entity
@Table(name = "fr_paymentcode")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FrPaymentcode.findAll", query = "SELECT f FROM FrPaymentcode f"),
    @NamedQuery(name = "FrPaymentcode.findByCodeId", query = "SELECT f FROM FrPaymentcode f WHERE f.codeId = :codeId"),
    @NamedQuery(name = "FrPaymentcode.findByPaymentCode", query = "SELECT f FROM FrPaymentcode f WHERE f.paymentCode = :paymentCode"),
    @NamedQuery(name = "FrPaymentcode.findByDescription", query = "SELECT f FROM FrPaymentcode f WHERE f.description = :description"),
    @NamedQuery(name = "FrPaymentcode.findByVal", query = "SELECT f FROM FrPaymentcode f WHERE f.val = :val"),
    @NamedQuery(name = "FrPaymentcode.findByStatus", query = "SELECT f FROM FrPaymentcode f WHERE f.status = :status"),
    @NamedQuery(name = "FrPaymentcode.findByDateCreated", query = "SELECT f FROM FrPaymentcode f WHERE f.dateCreated = :dateCreated")})
public class FrPaymentcode implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 36)
    @Column(name = "CodeId")
    private String codeId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 6)
    @Column(name = "PaymentCode")
    private String paymentCode;
    @Size(max = 500)
    @Column(name = "Description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Val")
    private float val;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Status")
    private int status;
    @Basic(optional = false)
    @NotNull
    @Column(name = "DateCreated")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateCreated;
    @JoinColumn(name = "ToUserId", referencedColumnName = "UserId")
    @ManyToOne
    private FrUser toUserId;
    @JoinColumn(name = "FromUserId", referencedColumnName = "UserId")
    @ManyToOne(optional = false)
    private FrUser fromUserId;
    @JoinColumn(name = "CurrencyId", referencedColumnName = "CurrencyId")
    @ManyToOne(optional = false)
    private FrCurrency currencyId;

    public FrPaymentcode() {
    }

    public FrPaymentcode(String codeId) {
        this.codeId = codeId;
    }

    public FrPaymentcode(String codeId, String paymentCode, float val, int status, Date dateCreated) {
        this.codeId = codeId;
        this.paymentCode = paymentCode;
        this.val = val;
        this.status = status;
        this.dateCreated = dateCreated;
    }

    public String getCodeId() {
        return codeId;
    }

    public void setCodeId(String codeId) {
        this.codeId = codeId;
    }

    public String getPaymentCode() {
        return paymentCode;
    }

    public void setPaymentCode(String paymentCode) {
        this.paymentCode = paymentCode;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public float getVal() {
        return val;
    }

    public void setVal(float val) {
        this.val = val;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public FrUser getToUserId() {
        return toUserId;
    }

    public void setToUserId(FrUser toUserId) {
        this.toUserId = toUserId;
    }

    public FrUser getFromUserId() {
        return fromUserId;
    }

    public void setFromUserId(FrUser fromUserId) {
        this.fromUserId = fromUserId;
    }

    public FrCurrency getCurrencyId() {
        return currencyId;
    }

    public void setCurrencyId(FrCurrency currencyId) {
        this.currencyId = currencyId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codeId != null ? codeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FrPaymentcode)) {
            return false;
        }
        FrPaymentcode other = (FrPaymentcode) object;
        if ((this.codeId == null && other.codeId != null) || (this.codeId != null && !this.codeId.equals(other.codeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fri.entiry.FrPaymentcode[ codeId=" + codeId + " ]";
    }
    
}
